package com.wy2.springcloud.sample.feignapp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

import com.wy2.springcloud.sample.feignapp.SampleRestClient.SampleRestClientFallback;

@FeignClient(name="base-rest",fallback=SampleRestClientFallback.class)
public interface SampleRestClient {
	
	
	@GetMapping("/")
	String index();
	
	@Component
	static class SampleRestClientFallback implements SampleRestClient{
		private static Logger logger=LoggerFactory.getLogger(SampleRestClientFallback.class);
		
		@Override
		public String index() {
			logger.info("SampleRestClient.index() fail");
			return "fail";
		}
		
	}

}
